package com.xsg.printer.core.model;
import com.xsg.printer.core.enums.*;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 * @author 高总辉
 * @desc
 * @date 2020/11/26 5:44 下午
 */
@Data
@Accessors(chain = true)
public class XsgFont {

    public static XsgFont defaultFont() {
        return new XsgFont().setFontFamily(FontFamilyEnum.BOLD).setColor(ColorEnum.BLACK).setFontStyle(FontStyleEnum.NORMAL).setFontSize(FontSizeEnum.MEDIUM).setNeedFeedLine(true);
    }

    /**
     * 字体 1-宋体、2-黑体、3-隶书、4-楷体
     * @see com.xsg.printer.core.enums.FontFamilyEnum
     */
    private int fontFamily;

    /**
     * 字体大小 1-最小 2-较小 2-小 4-正常 5-大 6-较大 7-非常大 8-超级大
     * @see com.xsg.printer.core.enums.FontSizeEnum
     */
    private int fontSize;

    /**
     * 字体风格 1-正常 2-加粗 3-斜体 4-加粗斜体
     * @see com.xsg.printer.core.enums.FontStyleEnum
     */
    private int fontStyle;

    /**
     * 字体颜色
     * @see com.xsg.printer.core.enums.ColorEnum
     */
    private int color;

    /**
     * 是否自动换行
     */
    private boolean needFeedLine;

    /**
     * 偏向
     */
    private String align;

    public XsgFont setAlign(AlignEnum alignEnum) {
        this.align = alignEnum.getCode();
        return this;
    }

    public XsgFont setColor(ColorEnum colorEnum) {
        this.color = colorEnum.getType();
        return this;
    }

    public XsgFont setFontFamily(FontFamilyEnum fontFamilyEnum) {
        this.fontFamily = fontFamilyEnum.getType();
        return this;
    }

    public XsgFont setFontStyle(FontStyleEnum fontStyleEnum) {
        this.fontStyle = fontStyleEnum.getType();
        return this;
    }

    public XsgFont setFontSize(FontSizeEnum fontSizeEnum) {
        this.fontSize = fontSizeEnum.getType();
        return this;
    }
}
